package com.gmstu.springorm.common.jdbc;

import com.gmstu.springorm.common.utils.Page;
import com.gmstu.springorm.framework.QueryRule;

import java.util.List;
import java.util.Map;

/**
 * @author John.Zhang
 * @version Id: BaseDao, v 0.1 2020/9/1 15:10 ZhiYong Exp $
 */
public interface BaseDao<T, PK> {

    List<T> select(QueryRule queryRule) throws Exception;

    Page<T> select(QueryRule queryRule, int pageIndex, int pageSize) throws Exception;

    List<Map<String, Object>> selectBySql(String sql, Object... args) throws Exception;

    Page<Map<String, Object>> selectBySqlToPage(String sql, Object[] param, int pageIndex, int pageSize) throws Exception;

    boolean deleteAll(List<T> list) throws Exception;

    PK insert(T entity) throws Exception;

    int insertAll(List<T> list) throws Exception;

    boolean update(T entity) throws Exception;
}
